package com.eec;

import com.eec.AOP.createProxyObject.JDKProxyObject;
import com.eec.test.AopTest.Test;
import com.eec.test.AopTest.testAAA;
import com.eec.spring.ApplicationContent;
import com.eec.spring.ioc.annotation.ComponentScan;
import com.eec.spring.ioc.annotation.Scope;
import com.eec.spring.ioc.springEnum.ScopeType;

/**
 * @author LeeC
 * @description
 * @date 2025/7/20
 * @PACKAGE_NAME com.eec.spring
 */
@ComponentScan("com.eec")
@Scope(ScopeType.SINGLETON)
public class AppConfig {
    public static void main(String[] args) {
        new ApplicationContent(AppConfig.class);
        // aop测试
        aopTest();
    }

    /**
     * aop 测试
     */
    public static void aopTest(){
        JDKProxyObject proxyObject = new JDKProxyObject();
        // 1. 保留真实实现类的引用（关键）
        Test realService = new testAAA();
        // 2. 创建代理对象
        Test proxyObject1 = (Test) proxyObject.createProxyObject(realService);

        // 调用代理方法
        int i = proxyObject1.doSomething(1);// 输出：class com.sun.proxy.$Proxy0
        System.out.println( i);
    }
}
